#!/usr/local/bin
#-*-coding:utf-8-*-

import os,socketserver

root_dir = 'D:\\Program Files\\aaa'

fl = []
def scan_dir(dir, file_list):
    for i in os.listdir(dir):
        sub_dir = os.path.join(dir, i)
        file = {"path": sub_dir, "size":0, "is_dir": 0}
        if os.path.isdir(sub_dir):
            file['is_dir'] = 1
            scan_dir(sub_dir, file_list)
        else:
            file['size'] = os.path.getsize(sub_dir)

        file_list.append(file)

    return file_list

def walk_dir(dir, file_list):

    for parent, dirnames, filenames in os.walk(dir):
        pass

scan_dir(root_dir, fl)
total_size = 0
for i in fl:
    total_size += i['size']

print(total_size/1024/1024)

